<template>
	<div>
		<Row>
			<Col class="p-1" :xs="24" :sm="24" :md="12" :lg="8" :xl="6" :xxl="4">
			<Input class="w-100" v-model="searchKey" placeholder="请输入课程名称" />
			</Col>
		</Row>
		<Row>
			<div class="w-100 d-flex justify-content-end align-items-center ">
				<Button class="m-1" type="primary" shape="circle" @click="searchs" icon="ios-search">查询</Button>
			</div>
		</Row>
		<div class="mt-1">
			<Row>
				<Col class="p-1" v-for="(row, index) in bms" :xs="24" :sm="24" :md="12" :lg="8" :xl="6"
					:xxl="6">
				<div :style="'background-image:url('+row.cover+'); background-size: 100% 100%;'"
					class="text-xss rounded shadow overflow-hidden">
					<div class="p-2 bg-black-80 text-fuguang d-flex text-lg justify-content-start">
						<span>{{row.kcmc}}</span>
					</div>
					<div class="2 bg-black-50 text-fuguang d-flex justify-content-end">
						<span>{{row.bmid}}</span>
					</div>
					<div class="p-2 bg-black-50 text-fuguang d-flex justify-content-end">
						<span class="text-danhong text-blod text-sm">
							<span v-if="row.stu == 'P'">排队中</span>
							<span v-if="row.stu == 'B'">已报名</span>
							<span v-if="row.stu == 'S'">已开始</span>
							<span v-if="row.stu == 'F'">已结束</span>
							<span v-if="row.stu == 'R'">提款中</span>
							<span v-if="row.stu == 'T'">已提款</span>
							<span v-if="row.stu == 'C'">已取消</span>
							<span v-if="row.stu == 'J'">退款中</span>
							<span v-if="row.stu == 'E'">已退款</span>
						</span>
					</div>

					<div class="p-2 bg-black-50 position-relative d-flex justify-content-between align-items-center">
						<!-- 左侧内容 -->
						<div class="w-45 position-relative d-flex flex-column align-items-center">
							<div class="padding-top-10"></div>
							<div class="position-relative rounded-circle overflow-hidden"
								style="width: 50px; height: 50px;">
								<img class="w-100 h-100" :src="row.headimg" />
							</div>
							<div class="text-danhong text-center mt-2 iconfont icon-yonghu">{{row.nc}}</div>
						</div>
						<!-- 中间占位 -->
						<div class="w-10"></div>
						<!-- 右侧内容 -->
						<div class="w-45 position-relative d-flex flex-column align-items-center">
							<div class="padding-top-10"></div>
							<div class="position-relative rounded-circle overflow-hidden"
								style="width: 50px; height: 50px;">
								<img class="w-100 h-100" :src="row.jcover" />
							</div>

							<div class="text-danhong text-center mt-2 text-xs">{{row.jlmc}}</div>
						</div>
					</div>

					<div class="p-1 bg-black-50 d-flex justify-content-end">
						<Button class="text-xss ml-2" type="primary" size="small" @click="show(row.bmid)">详细</Button>

					</div>
				</div>
				</Col>
			</Row>
		</div>
		<div>
			<Page class="text-right mt-3" :page-size="tableInfo.pageSize" @on-change="pageSearch"
				:total="tableInfo.total" />
		</div>
	</div>
</template>
<script>
	export default {
		data() {
			return {
				searchKey: "",
				tableInfo: {
					currentPage: 1,
					pageSize: 12,
					total: 0
				},
				bms: []
			}
		},
		methods: {
			init: function() {
				this.tableInfo.currentPage = 1;
				this.search();
			},
			newUser: function() {
				this.$router.push({
					path: "/bm/new"
				})
			},
			show: function(bmid) {
				this.$router.push({
					path: "/bm/detail?id=" + bmid
				})
			},
			searchs: function() {
				this.tableInfo.currentPage = 1;
				this.search();
			},
			search: function() {
				this.http.get({
					url: "/client/bm/page",
					params: {
						// 传一个当前页
						current: this.tableInfo.currentPage,
						size: this.tableInfo.pageSize,
						searchKey: this.searchKey
					}
				}).then(data => {
					this.bms = data.records;
					this.tableInfo.currentPage = data.current;
					this.tableInfo.total =data.total;
					this.tableInfo.pageSize = data.size;
				})
			},
			pageSearch: function(changedPage) {
				this.tableInfo.currentPage = changedPage;
				this.search();
			}
		},
		created: function() {
			this.init();
		}
	}
</script>

<style>

</style>